;
(function() {

	module.exports = {
		prefix: "/user/collect_bus",
		get: {
			//获取当前用户的收藏夹列表
			"/": function() {
				var user = role.getUser(this);
				var query = this.request.query;
				var collectBus = user.getCollectBusDetail(query.num, query.page);
				this.body = ResponObj("json", collectBus);
			},
			// "/with_page_info":function () {
			// 	var user  = role.getUser(this);
			// 	var query = this.request.query;
			// 	var info = user.getCollectBusDetail_PageInfo(query.num,query.page)
			// 	this.body = ResponObj("json",info);
			// },
			//商家信息以及商家的“最新”商品信息
			"/with_goods_info": function() {
				var user = role.getUser(this);
				var query = this.request.query;
				var goods_num = query.goods_num || 5;
				var collectBus = user.getCollectBusDetail(query.num, query.page, goods_num);
				this.body = ResponObj("json", collectBus);
			}
		},
		post: {
			"/add_bus": function() {
				var user = role.getUser(this);
				var body = this.request.body;
				var bus_id = body.bus_id;
				if (!bus_id) {
					throwCusError("参数错误")
				}
				var collectBus = user.addBusToCollectBus(bus_id);
				this.body = ResponObj("json", collectBus);
			}
		},
		put: {},
		"delete": {
			"/remove_bus": function() {
				var user = role.getUser(this);
				var body = this.request.body;
				var bus_id = body.bus_id;
				if (!bus_id) {
					throwCusError("参数错误")
				}
				var collectBus = user.removeBusFromCollectBus(bus_id);
				this.body = ResponObj("json", collectBus);
			}
		}
	};
	var role = require("./role");
	var BusCon = require("../../core/bus/_con");
	var UserCon = require("../../core/user/_con");
	var GoodsCon = require("../../core/goods/_con");
	var AchCon = require("../../core/ach/_con");
	var db = require("../../core/db/index");
	var config = require("../../core/_include/config");
	var ResponObj = require("../_include/responObj");

}());